package com.example.app.data.bean

import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.Done
import androidx.compose.material.icons.rounded.Info
import androidx.compose.material.icons.rounded.Refresh
import androidx.compose.material.icons.rounded.Warning
import androidx.compose.ui.graphics.vector.ImageVector
import com.example.app.data.enum.TipState

data class TipType(
    var text: String? = null,
    var type: TipState? = null,
    var icon: ImageVector? = null
) {
    fun success(
        _text: String? = null,
        _icon: ImageVector? = null
    ): TipType {
        text = if (_text == null) TipState.TIP_SUCCESS.label else _text
        type = TipState.TIP_SUCCESS
        icon = if (_icon == null) Icons.Rounded.Done else _icon
        return TipType(
            text,
            type,
            icon
        )
    }

    fun error(
        _text: String? = null,
        _icon: ImageVector? = null
    ): TipType {
        text = if (_text == null) TipState.TIP_ERROR.label else _text
        type = TipState.TIP_ERROR
        icon = if (_icon == null) Icons.Rounded.Warning else _icon
        return TipType(
            text,
            type,
            icon
        )
    }

    fun info(
        _text: String? = null,
        _icon: ImageVector? = null
    ): TipType {
        text = if (_text == null) TipState.TIP_INFO.label else _text
        type = TipState.TIP_INFO
        icon = if (_icon == null) Icons.Rounded.Info else _icon
        return TipType(
            text,
            type,
            icon
        )
    }

    fun loading(
        _text: String? = null,
        _icon: ImageVector? = null
    ): TipType {
        text = if (_text == null) TipState.TIP_LOADING.label else _text
        type = TipState.TIP_LOADING
        icon = if (_icon == null) Icons.Rounded.Refresh else _icon
        return TipType(
            text,
            type,
            icon
        )
    }
}

